package com.audaque.springboot.foshanupload.web.nosaveframeworklogin.config;


import com.audaque.springboot.foshanupload.authcore.properties.LoginProperties;
import com.audaque.springboot.foshanupload.authcore.properties.SessionJwtOrderProperties;
import com.audaque.springboot.foshanupload.web.nosaveframeworklogin.interceptor.LoginResponseInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zgb
 * @desc Interceptor用于鉴证和鉴权
 * @date 2022-01-25 22:24:15
 */
@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private LoginResponseInterceptor loginResponseInterceptor;

    @Autowired
    private LoginProperties loginProperties;
    @Autowired
    private SessionJwtOrderProperties sessionJwtOrderProperties;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginResponseInterceptor).addPathPatterns(loginProperties.getLoginUrl()).order(sessionJwtOrderProperties.getLoginResponseInterceptor());
    }


}
